<div id="control">
	<a href="{Url::anchor("admin/product/index/{Input::get(3)}")}" class="item small text"><img src="/styles/admin/gfx/icons/small/cancel.png" alt="Đóng"/><span>Đóng</span></a>
</div>

<div class="section">
	<div class="box">
		<div class="title">
			Thêm sản phẩm
			<span class="hide"></span>
		</div>
		<div class="content">
			<form action="{Url::current()}" method="post" enctype="multipart/form-data">
				<div class="row">
					<label>Tiêu đề *</label>
					<div class="right"><input type="text" name="txtName" value="{if isset($product)}{$product.name}{/if}" maxlength="200" placeholder="Max. 200 characters..." /></div>
				</div>
				<div class="row">
					<label>Keywords</label>
					<div class="right"><input type="text" name="txtKeys" value="{if isset($product)}{$product.keywords}{/if}"/></div>
				</div>
				<div class="row">
					<label>Description</label>
					<div class="right"><input type="text" name="txtDesc" value="{if isset($product)}{$product.description}{/if}"/></div>
				</div>
                <div class="row">
					<label>Thuộc danh mục</label>
					<div class="right">
						<select name="slcCategory" class="big">
							{foreach $categories as $row}
							<option value="{$row.id}" {if isset($product.category) && $row.id eq $product.category} selected=""{elseif Input::get(3) eq  $row.id && Input::get(2) eq 'add'} selected=""{/if} >{$row.name}</option>
							{/foreach}
						</select>
					</div>
				</div>   
                <div class="row">
                    <label>Mô tả</label>
                    <div class="right"><textarea name="txtShort" rows="" cols="" style="height : 60px;">{if isset($product)}{$product.content_short}{/if}</textarea></div>
                </div>
                <div class="row">
					<label>Nội dung </label>
					<div class="right">
					{if isset($product)}
        				{Editor::display('txtContent', {$product.content}, TRUE)}
        			{else}
        				{Editor::display('txtContent', NULL, TRUE)}
        			{/if}
					</div>
				</div>
                <div class="row">
					<label>Image</label>
					<div class="right">
						{if isset($product.images) && $product.images neq ''}<img src="{$product.images}" width="160px" height="100px" alt="image" style="margin-bottom:10px" /><br />{/if}
						<input type="file" name="images" />
					</div>
				</div>
                <div class="row">
					<label>Công ty: </label>
					<div class="right"><input type="text" name="company" value="{if isset($product.company)}{$product.company}{/if}"/></div>
				</div>
                <div class="row">
					<label>Địa chỉ: </label>
					<div class="right"><input type="text" name="address" value="{if isset($product.address)}{$product.address}{/if}"/></div>
				</div>
                <div class="row">
					<label>Điện thoại: </label>
					<div class="right"><input type="text" name="phone" value="{if isset($product.phone)}{$product.phone}{/if}"/></div>
				</div>
                <div class="row">
					<label>Giá gốc: </label>
					<div class="right"><input type="text" name="price" value="{if isset($product.price)}{$product.price}{/if}"/></div>
				</div>
                <div class="row">
					<label>Khuyến mãi %: </label>
					<div class="right"><input type="text" name="per" value="{if isset($product.per)}{$product.per}{/if}"/></div>
				</div>
                <div class="row">
                    <label>Thời gian khuyến mãi:</label>
                    <div class="right">
                        Bắt đầu: <input type="text" class="datepicker" name="date_start" value="{if isset($product.date_start) && $product.date_start neq 0}{date('m.d.Y',strtotime($product.date_start))}{/if}" placeholder="mm.dd.yyyy" />. 
                        Kết thúc: <input type="text" class="datepicker" name="date_end" value="{if isset($product.date_end) && $product.date_end neq 0}{date('m.d.Y',strtotime($product.date_end))}{/if}" placeholder="mm.dd.yyyy" />
                    </div>
                </div>
                <div class="row">
					<label>Sắp xếp: </label>
					<div class="right"><input type="text" name="txtSort" style="width:80px;" value="{if isset($product.sort)}{$product.sort}{/if}" /></div>
				</div>
                <div class="row">
					<label>Tình trạng</label>
					<div class="right">
						<select name="slcStatus">
                            <option value="1" {if isset($product.status)&& $product.status eq 1} selected="" {/if}>Bật</option>
							<option value="0" {if isset($product.status)&& $product.status eq 0} selected="" {/if}>Tắt</option>										
						</select>
					</div>
				</div>
                <div class="row">
					<div class="right">
                        <input type="hidden" name="token" value="{Security::setToken('token_form')}" />
						<input type="hidden" name="action" value="{$action}" />
						<button type="submit"><span>Save</span></button>
					</div>
				</div>
			</form>
		</div>
	</div>
</div>